#include "Tcpserver.hpp"
#include <iostream>
#include <memory>

void Usage(string proc)
{
    cout<<"\n\r usage:"<<proc<<" port[1024+]\n"<<endl;
}

//./tcpserver serverport
int main(int argc,char* argv[])
{
    if(argc!= 2)
    {
        Usage(argv[0]);  //argv:char**      
        exit(UsageError);
    }

    uint16_t serverport=std::stoi(argv[1]);  //argv[1]: serverport

    unique_ptr<TcpServer> tcp_svr(new TcpServer(serverport));

    tcp_svr->ServerInit();
    tcp_svr->Start();

    return 0;
}